package com.etc.entity;

import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * (User)实体类
 *
 * @author makejava
 * @since 2021-10-18 21:07:18
 */
@Component
public class User implements Serializable {
    private static final long serialVersionUID = 367293000091077164L;
    /**
     * 用户
     */
    private String userId;
    /**
     * 用户名
     */
    private String userName;
    /**
     * 密码
     */
    private String userPassword;
    /**
     * 盐
     */
    private String salt;
    /**
     * 电话
     */
    private String userPhone;
    /**
     * 状态 0 启用 1 封禁
     */
    private Integer userState;
    /**
     * 等级 0 管理员 1 主播 2 普通用户
     */
    private Integer userLevel;
    /**
     * 用户头像
     */
    private String userImg;
    /**
     * 余额
     */
    private BigDecimal userPrice;


    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public Integer getUserState() {
        return userState;
    }

    public void setUserState(Integer userState) {
        this.userState = userState;
    }

    public Integer getUserLevel() {
        return userLevel;
    }

    public void setUserLevel(Integer userLevel) {
        this.userLevel = userLevel;
    }

    public String getUserImg() {
        return userImg;
    }

    public void setUserImg(String userImg) {
        this.userImg = userImg;
    }

    public BigDecimal getUserPrice() {
        return userPrice;
    }

    public void setUserPrice(BigDecimal userPrice) {
        this.userPrice = userPrice;
    }

    public User() {
    }

    public User(String userId, String userName, String userPassword, String salt, String userPhone, Integer userState, Integer userLevel, String userImg, BigDecimal userPrice) {
        this.userId = userId;
        this.userName = userName;
        this.userPassword = userPassword;
        this.salt = salt;
        this.userPhone = userPhone;
        this.userState = userState;
        this.userLevel = userLevel;
        this.userImg = userImg;
        this.userPrice = userPrice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(userId, user.userId) &&
                Objects.equals(userName, user.userName) &&
                Objects.equals(userPassword, user.userPassword) &&
                Objects.equals(userPhone, user.userPhone) &&
                Objects.equals(userState, user.userState) &&
                Objects.equals(userLevel, user.userLevel) &&
                Objects.equals(userImg, user.userImg) &&
                Objects.equals(userPrice, user.userPrice);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, userName, userPassword, userPhone, userState, userLevel, userImg, userPrice);
    }

    @Override
    public String toString() {
        return "User{" +
                "userId='" + userId + '\'' +
                ", userName='" + userName + '\'' +
                ", userPassword='" + userPassword + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", userState=" + userState +
                ", userLevel=" + userLevel +
                ", userImg='" + userImg + '\'' +
                ", userPrice=" + userPrice +
                '}';
    }

    /**
     * 登录需要 
     * @param userName
     * @param userPassword
     */
    public User(String userName, String userPassword){
        this.userName = userName;
        this.userPassword = userPassword;
    }

    public User(String userName, String userPassword, String salt) {
        this.userName = userName;
        this.userPassword = userPassword;
        this.salt = salt;
    }

    /**
     * 新增需要 没有id
     * @param userName
     * @param userPassword
     * @param userPhone
     * @param userState
     * @param userLevel
     * @param userImg
     * @param userPrice
     */
    public User(String userName, String userPassword, String salt, String userPhone, Integer userState, Integer userLevel, String userImg, BigDecimal userPrice) {
        this.userName = userName;
        this.userPassword = userPassword;
        this.salt = salt;
        this.userPhone = userPhone;
        this.userState = userState;
        this.userLevel = userLevel;
        this.userImg = userImg;
        this.userPrice = userPrice;
    }

    public User(String userId) {
        this.userId = userId;
    }
}

